package com.wbt.huawei;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Stack;

public class Huyang {

    public static Stack<Integer> stack = new Stack<Integer>();
    public static int num = 0;
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String str = null;
        while (( str = bf.readLine()) != null){
            int n = Integer.parseInt(str);
            int m = Integer.parseInt(bf.readLine());
            String[] ms = bf.readLine().split(",");
            int[] msInt = Arrays.asList(ms).stream().mapToInt(Integer::parseInt).toArray();
            int k = Integer.parseInt(bf.readLine());
            f(msInt,m-k,0,0,n); // 从这个数组msInt个数中选择m-k个
            System.out.println(num);
        }
    }

    private static void f(int[] shu, int targ, int has, int cur,int n) {
        if(has == targ) {
            System.out.println(stack);
            Stack<Integer> stack2 = (Stack<Integer>) stack.clone ();
            int end = n;
            int start = 1;
            while (!stack2.empty()){
                start = stack2.pop();
                if(end-start > num) num =end-start;
                end = start;
            }
            if(end-1 > num) num = end - 1;
            return;
        }
        for(int i=cur;i<shu.length;i++) {
            if(!stack.contains(shu[i])) {
                stack.add(shu[i]);
                f(shu, targ, has+1, i,n);
                stack.pop();
            }
        }
    }
}
